#include "exceptions.h"
#include "util.h"


namespace Database
{

namespace Util
{

//
// See header file for definitions of various inline fns
//

// FIXME - work out wtf is needed here and implement it
string unquote(const string& s)
{
    if(!s.length())
        return s;

    string ret;

    // If the string is quoted, ensure that the start and end characters are the same type of quote
    // (single-quote or double-quote).
    if(s.front() == '\'')
    {
        if(s.back() != '\'')
            throw EStringSyntax();

        ret = s.substr(1, s.length() - 2);
    }
    else if(s.front() == '"')
    {
        if(s.back() != '"')
            throw EStringSyntax();

        ret = s.substr(1, s.length() - 2);
    }
    else
        ret = s;

/*
    for(auto i : s)
    {

    }
*/
    return "DOESN'T WORK - FIXME";
}


}   // namespace Util

}   // namespace Database
